package com.mybatisx.mybatisplus.controller;


import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wuyue
 * @since 2021-06-23
 */
@RestController
@RequestMapping("/login/users")
public class UsersController {

    @GetMapping("/hello")
    public String hello() {
        return "hello spring security";
    }

    @PostMapping("/error")
    public String error() {
        return "login error";
    }

    @GetMapping("/testSecured")
    @Secured("ROLE_USER")
    public String testSecured() {
        return "success";
    }
}

